package day07;

import java.util.Scanner;

public class CalTotalAvg {
    public static void main(String[] args) {
        double[] score=sa();
        double total=total(score);
        System.out.println(total);
        double avg=avg(score);
        System.out.println("平均分为："+avg);
    }

public static double[] sa(){
    Scanner scan=new Scanner(System.in);
    double [] a=new double[6];
    for(int i=0;i<a.length;i++){
        System.out.println("请输入第"+(i+1)+"个评委的分数：");
        a[i]=scan.nextDouble();
    }
    return a;
}
public static double total(double[] a){
        double total=0.0;
        double max=a[0];
        double min=a[0];
        for(int i=1;i<a.length;i++){
            if(a[i]>max){
                max=a[i];
            }
            if(a[i]<min){
                min=a[i];
            }
            total+=a[i];
        }

        return total-max-min;
}
public static double avg(double[] a){
        double total=total(a);
        double avg=total/(a.length-2);
        return avg;
}

}